package com.mytest.provider.es.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("spec")
public class SpecController {


//    @Autowired
//    private SpecService specService;


    /**
     *
     * 根据分类的id查询分类对应的规格组
     * 查询调用SpecService，specService 调用SpecMapper
     * specMapper 查询使用通用mapper
     * @param cid
     * @return
     */
   /* @GetMapping("groups/{cid}")
    public ResponseEntity<List<SpecGroup>> querySpecGroups(@PathVariable("cid")Long cid){

        List<SpecGroup> specGroups = this.specService.querySpecGroups(cid);

        //校验内容是否为空
        if (specGroups != null && 0!=specGroups.size()) {
            return ResponseEntity.ok(specGroups);
        }

        return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
    }
*/

    /**
     *
     * 根据分类的id，查询分类下面的规格参数的信息
     * 由于分类的id'不是规格参数的主键id，所以还是属性查询
     *
     * 或者根据分类的id查询对应所有的规格参数
     * @param gid
     * @return
     */
    /*@GetMapping("params")
    public ResponseEntity<List<SpecParam>> querySpecParam(
            @RequestParam(value = "gid",required = false)Long gid,
            @RequestParam(value = "cid",required = false)Long cid){

        List<SpecParam> specParams = this.specService.querySpecParam(gid,cid);

        if (specParams != null && 0!=specParams.size()) {
            return ResponseEntity.ok(specParams);
        }
        return ResponseEntity.status(HttpStatus.NO_CONTENT).build();//204
    }
*/
}
